<%@ page language="java" import="java.util.*,com.hf.listener.*,com.opensymphony.xwork2.util.*" pageEncoding="UTF-8"%>

<% 

String test="";
HttpSession s;

ValueStack vs=(ValueStack)request.getAttribute("struts.valueStack");
String sessionId=(String)vs.findValue("sessionId");
if(sessionId.equals("")){
	s= request.getSession(); 
	MySessionContext.AddSession(s);		//当sessionId不存在才添加session
	sessionId=s.getId();
	if(s.isNew())
		test="new session";
}else{
	s=MySessionContext.getSession(sessionId);
	if(s==null)		// 测试用 一般不会出现此情况
		test="不存在该session";
	else if(!s.isNew())
		test="old session";	
		
}

if((Integer)vs.findValue("times")==9){
	s.invalidate();
	MySessionContext.DelSession(s);
}

int count=MySessionContext.getSessionCounts();
	
%>
	


<body>   

<!-- 每个页面的模板，以下是正文 --> 

<script type="text/javascript">
function tijiao(){
	//$("#opType").val(2);	
	document.form1.submit();
};


</script>

<body>   
<%@ include file="_daohang.jsp" %>

<!-- 每个页面的模板，以下是正文 -->    

<form name="form1" action="test_session" method ="post">
<div class="input-group">
<input type="text" class="form-control"  name="sessionId" value="<%=sessionId %>">
<input type="text" class="form-control"  value="test:<%=test %>">
<input type="text" class="form-control"  value="created:<%=s.getCreationTime()  %>">
<input type="text" class="form-control"  value="max:<%=s.getMaxInactiveInterval() %>">

<input type="text" class="form-control"  value="count:<%=count %>">
<input type="text" class="form-control" name="times" value="<s:property value="times"/>">
<input type="text" class="form-control"  name="memo" value="<s:property value="memo"/>">
<input type="text" class="form-control"  name="tip" value="<s:property value="tip"/>">
<input type="button" class="btn btn-primary" value="提交"  onClick="tijiao()"  />

</div>
</form>

</body>
</html>